﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MyHealthByDesignWebsite.Controllers
{
    //Description:  Use to get PAR-Q and YOU and Questionnaire data
    //Created:  Nov 2011
    //Programmer: Kinosha Wimalaratne 

    public class PARQController : Controller
    {
        
        
        //
        // GET: /PARQ/PARQNYOU

        public ActionResult PARQNYOU()
        {
            return View();
        }

        //
        // POST: /PARQ/PARQNYOU
        //pre-condition: UserID has been saved in cookie and user age should be < 40
        //post-condition: redirect to Notice or back to the site
       [HttpPost]
        public ActionResult PARQNYOU(string submitButton)
        {
            string path = "";
            switch (submitButton)
            {
                case "YES to any of the statements":
                    {
                        path = "PARQNotice";
                        break;
                    }
                case "NO to any of the statements":
                    {
                        path = "GoodToGo";
                        break;
                    }
            }
            return RedirectToAction(path, "PARQ");
        }

       //
       // GET: /PARQ/GoodToGo
       public ActionResult GoodToGo()
       {
           return View();
       }

       //
       // POST: /PARQ/GoodToGo
        [HttpPost]
       public ActionResult GoodToGo(FormCollection result)
       {
           return RedirectToAction("MyHealth", "Home");
       }

        //
        // GET: /PARQ/Questionnaire
       public ActionResult Questionnaire()
       {
           return View();
       }

       //
       // POST: /PARQ/Questionnaire
       //pre-condition: UserID has been saved in cookie and user age should be >40
       //post-condition: redirect to site or notice page
        [HttpPost]
       public ActionResult Questionnaire(string submitButton)
       {
           switch (submitButton)
           {
               case "YES to any of the risk factors":
                   return RedirectToAction("QuestionnaireNotice","PARQ");
               case "None of the above are true":
                   return RedirectToAction("GoodToGoQuestionnaire","PARQ");
           }
           return View();
       }

       //
       // GET: /PARQ/GoodToGoQuestionnaire
        public ActionResult GoodToGoQuestionnaire()
        {
            return View();
        }

        //
        // POST: /PARQ/GoodToGoQuestionnaire
        //pre-condition: UserID has been saved in cookie
        //post-condition: redirect to my health home page
        [HttpPost]
        public ActionResult GoodToGoQuestionnaire(FormCollection result)
        {
            return RedirectToAction("MyHealth", "Home");
        }

        //
        // GET: /PARQ/QuestionnaireNotice
        public ActionResult QuestionnaireNotice()
        {
            return View();
        }

        //
        // POST: /PARQ/QuestionnaireNotice
        //pre-condition: UserID has been saved in cookie
        //post-condition: redirect to disclaimer page
        [HttpPost]
        public ActionResult QuestionnaireNotice(string submitButton)
        {
              return RedirectToAction("Disclaimer","PARQ");
               
        }

        //
        // GET: /PARQ/PARQNotice
        public ActionResult PARQNotice()
        {
            return View();
        }

        //
        // POST: /PARQ/PARQNotice
        //pre-condition: UserID has been saved in cookie and user has to submit PAR-Q with yes
        //post-condition: reditect to questionnaire page 
        [HttpPost]
        public ActionResult PARQNotice(FormCollection result)
        {
            return RedirectToAction("Questionnaire", "PARQ");
        }

        //
        // GET: /PARQ/Disclaimer
        public ActionResult Disclaimer()
        {
            return View();
        }

        //
        // POST: /PARQ/Disclaimer
        //pre-condition: UserID has been saved in cookie
        //post-condition: redirect acoding to user input
        [HttpPost]
        public ActionResult Disclaimer(string submitButton)
        {
            switch (submitButton)
            {
                case "YES":
                    return RedirectToAction("MyHealth", "Home");
                case "NO":
                    return RedirectToAction("DisclaimerNotice","PARQ");
            }
            return View();
        }

        //
        // GET: /PARQ/DisclaimerNotice
        public ActionResult DisclaimerNotice()
        {
            return View();
        }

    }
}